package cn.edu.hizee.gps.model;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "t_user_contact", schema = "EHelp", catalog = "")
public class UserContact {
    private int id;
    private Integer userId;
    private Integer contactId;

    public UserContact(Integer userId, Integer contactId) {
        this.userId = userId;
        this.contactId = contactId;
    }

    public UserContact() {
    }

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "user_id")
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "contact_id")
    public Integer getContactId() {
        return contactId;
    }

    public void setContactId(Integer contactId) {
        this.contactId = contactId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserContact that = (UserContact) o;
        return id == that.id &&
                Objects.equals(userId, that.userId) &&
                Objects.equals(contactId, that.contactId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, contactId);
    }
}
